<?php namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Tags
 *
 * @property integer $id
 * @property string $tag
 * @property string $deleted_at
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Investor[] $investor_x_tags
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\InvestOrg[] $investorg_x_tags
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Project[] $project_x_tags
 * @method static \Illuminate\Database\Query\Builder|\App\Tags whereId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Tags whereTag($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Tags whereDeletedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Tags whereCreatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Tags whereUpdatedAt($value)
 */
class Tags extends Model {

    protected $table = 'tags';
    use SoftDeletes;

    /** 关联中间表-投资人标签 */
    public function investor_x_tags()
    {
       return $this->belongsToMany('App\Investor','tags_relations','tag_id','investor_id');
    }

    /** 关联中间表-投资机构标签 */
    public function investorg_x_tags()
    {
        return $this->belongsToMany('App\InvestOrg','tags_relations','tag_id','org_id');
    }

    /** 关联中间表-项目标签 */
    public function project_x_tags()
    {
        return $this->belongsToMany('App\Project','tags_relations','tag_id','project_id');
    }

}
